home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-11-14 | 7.5 KB | 175 lines | [TEXT/R*ch] |
- // ===========================================================================
- // File: CMPDGrayCouncilTabs.cp
- // Version: 1.0 - Sept 9, 1996
- // Author: Mike Shields (mshields@inconnect.com)
- //
- // Copyright ©1996 Mike Shields. All rights reserved.
- // I hereby grant users of CMPDGrayCouncilTabs permission to use it (or any modified
- // version of it) in applications (or any other type of Macintosh software
- // like extensions -- freeware, shareware, commercial, or other) for free,
- // subject to the terms that:
- //
- // (1) This agreement is non-exclusive.
- //
- // (2) I, Mike Shields, retain the copyright to the original source code.
- //
- // These two items are the only required conditions for use. However, I do have
- // an additional request. Note, however, that this is only a request, and
- // that it is not a required condition for use of this code.
- //
- // (1) That I be given credit for CMPDGrayCouncilTabs code in the copyrights or
- // acknowledgements section of your manual or other appropriate documentation.
- //
- //
- // I would like to repeat that this last item is only a request. You are prefectly
- // free to choose not to do any or all of them.
- //
- // This source code is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- // ===========================================================================
- // CMPDGrayCouncilTabs.h <- double-click + Command-D to see class declaration
- //
- // A subclass of AGATabPanelPPX which has been adapted to work with the MPD classes.
-
- #include "CMPDGrayCouncilTabs.h"
-
- //===========================================================================
- // CMPDGrayCouncilTabs
- //===========================================================================
- #pragma mark class CMPDGrayCouncilTabs
-
- //----------------------------------------------------------------------------------------
- // CMPDGrayCouncilTabs::CreateFromStream
- //----------------------------------------------------------------------------------------
- CMPDGrayCouncilTabs* CMPDGrayCouncilTabs::CreateFromStream(LStream* inStream)
- {
- return new CMPDGrayCouncilTabs(inStream);
- }
-
- //----------------------------------------------------------------------------------------
- // CMPDGrayCouncilTabs::CMPDGrayCouncilTabs
- //----------------------------------------------------------------------------------------
- CMPDGrayCouncilTabs::CMPDGrayCouncilTabs(LStream* inStream)
- : AGATabPanelPPX(inStream)
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CMPDGrayCouncilTabs::~CMPDGrayCouncilTabs
- //----------------------------------------------------------------------------------------
- CMPDGrayCouncilTabs::~CMPDGrayCouncilTabs()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CMPDGrayCouncilTabs::SetValue
- //----------------------------------------------------------------------------------------
- void CMPDGrayCouncilTabs::SetValue(SInt32 inValue)
- {
- AGATabPanelPPX::SetValue(inValue);
-
- // In addition to setting the current tab we also need to tell our "owner" we've changed.
- ReportPanelIDChanged();
- }
-
- //----------------------------------------------------------------------------------------
- // CMPDGrayCouncilTabs::InsertPanelIDs
- //----------------------------------------------------------------------------------------
- void CMPDGrayCouncilTabs::InsertPanelIDs(MPDPtr inPanelIDData)
- {
- for ( Int16 i = 0; i < inPanelIDData->numItems; i++ )
- {
- // Call the base classes method directly since this class' method is stubbed out
- AGATabPanelPPX::AddPanel(0, inPanelIDData->MPDList[i].name);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CMPDGrayCouncilTabs::ReportPanelIDChanged
- //----------------------------------------------------------------------------------------
- void CMPDGrayCouncilTabs::ReportPanelIDChanged(void)
- {
- // Wrap the ReportPanelIDChanged with custom color values so that the
- // AGA objects in the panel hierarchy will get the right background
- // colors. This is because we know that the ReportPanelIDChanged method
- // causes a new panel to load. And if it doesn't in the future, then no
- // problem.
- TurnOnCustomAGABackgroundColors(&gAGARamp[r1], &gAGARamp[r2]);
- CMPDPanelSelectControl::ReportPanelIDChanged();
- TurnOffCustomAGABackgroundColors();
- }
-
- //----------------------------------------------------------------------------------------
- // CMPDGrayCouncilTabs::SelectPanelID
- //----------------------------------------------------------------------------------------
- void CMPDGrayCouncilTabs::SelectPanelID(PanelIDIndexT inPanelID)
- {
- // AGATabPanelPPX is 0-based while the MPD classes are 1-based
- SetValue(inPanelID - 1);
- }
-
- //----------------------------------------------------------------------------------------
- // CMPDGrayCouncilTabs::GetCurrentPanelID
- //----------------------------------------------------------------------------------------
- PanelIDIndexT CMPDGrayCouncilTabs::GetCurrentPanelID(void) const
- {
- // AGATabPanelPPX is 0-based while the MPD classes are 1-based
- return (PanelIDIndexT)(AGATabPanelPPX::GetValue() + 1);
- }
-
- //----------------------------------------------------------------------------------------
- // CMPDGrayCouncilTabs::InstallPanel
- //----------------------------------------------------------------------------------------
- // We overide this to only set the tab labels and make sure the tabs are calculated correctly.
- void CMPDGrayCouncilTabs::InstallPanel(SInt32 tabIndex, ResIDT panelResourceID,
- StringPtr tabLabel)
- {
- if (tabLabel != NULL)
- {
- mAGAObject->SetTabLabel(tabIndex, tabLabel);
- mAGAObject->CalculateTabWidths();
- }
- }
- //===========================================================================
- // CMPDSmallGrayCouncilTabs
- //===========================================================================
- #pragma mark class CMPDSmallGrayCouncilTabs
-
- //----------------------------------------------------------------------------------------
- // CMPDSmallGrayCouncilTabs::CreateFromStream
- //----------------------------------------------------------------------------------------
- CMPDSmallGrayCouncilTabs* CMPDSmallGrayCouncilTabs::CreateFromStream(LStream* inStream)
- {
- return new CMPDSmallGrayCouncilTabs(inStream);
- }
-
- //----------------------------------------------------------------------------------------
- // CMPDSmallGrayCouncilTabs::CMPDSmallGrayCouncilTabs
- //----------------------------------------------------------------------------------------
- CMPDSmallGrayCouncilTabs::CMPDSmallGrayCouncilTabs(LStream* inStream)
- : CMPDGrayCouncilTabs(inStream)
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CMPDSmallGrayCouncilTabs::~CMPDSmallGrayCouncilTabs
- //----------------------------------------------------------------------------------------
- CMPDSmallGrayCouncilTabs::~CMPDSmallGrayCouncilTabs()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CMPDSmallGrayCouncilTabs::CreateAGAObject
- //----------------------------------------------------------------------------------------
- // basically the same as the AGASmallTabPanelPP method, we just inherit differently
- void CMPDSmallGrayCouncilTabs::CreateAGAObject()
- {
- CMPDGrayCouncilTabs::CreateAGAObject();
-
- // Set the tabs to use the standard small appearance.
- mAGAObject->SetTabSize(AGATabPanel::kSmallTabs);
- mAGAObject->SetLabelsStyle(gAGAStdBoldSmallStyle);
- }
-
-